#include <iostream>
#include <pthread.h>
#include <cstdlib>

struct Args {
    int a;
    int b;
};

void* compute_sum(void* arg) {
    Args* args = static_cast<Args*>(arg);
    int* result = new int(args->a + args->b);
    delete args;
    return result;
}

int main() {
    pthread_t tid;
    Args* args = new Args{10, 20};
    pthread_create(&tid, nullptr, compute_sum, args);
    int* result;
    pthread_join(tid, (void**)&result);
    std::cout << "Sum result: " << *result <<std::endl;
    delete result;
    return 0;
}
